<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="htmlId">
<head>
    <title>Coverage Report :: BoardFactoryTest</title>
    <style type="text/css">
        @import "../../.css/coverage.css";
    </style>
</head>

<body>
<div class="header"></div>

<div class="content">
    <div class="breadCrumbs">
        [ <a href="../../index.html">all classes</a> ]
        [ <a href="../index.html">nl.tudelft.jpacman.board</a> ]
    </div>

    <h1>Coverage Summary for Class: BoardFactoryTest (nl.tudelft.jpacman.board)</h1>

    <table class="coverageStats">
        <tr>
            <th class="name">Class</th>
            <th class="coverageStat
">
                Class, %
            </th>
            <th class="coverageStat
">
                Method, %
            </th>
            <th class="coverageStat
">
                Line, %
            </th>
        </tr>
        <tr>
            <td class="name">BoardFactoryTest</td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 1)
  </span>
            </td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 7)
  </span>
            </td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 19)
  </span>
            </td>
        </tr>

    </table>

    <br/>
    <br/>


    <div class="sourceCode"><i>1</i>&nbsp;package nl.tudelft.jpacman.board;
        <i>2</i>&nbsp;
        <i>3</i>&nbsp;import static org.assertj.core.api.Assertions.assertThat;
        <i>4</i>&nbsp;import static org.mockito.Mockito.mock;
        <i>5</i>&nbsp;import nl.tudelft.jpacman.sprite.PacManSprites;
        <i>6</i>&nbsp;
        <i>7</i>&nbsp;import org.junit.jupiter.api.BeforeEach;
        <i>8</i>&nbsp;import org.junit.jupiter.api.Test;
        <i>9</i>&nbsp;
        <i>10</i>&nbsp;import java.util.Arrays;
        <i>11</i>&nbsp;
        <i>12</i>&nbsp;/**
        <i>13</i>&nbsp; * Tests the linking of squares done by the board factory.
        <i>14</i>&nbsp; *
        <i>15</i>&nbsp; * @author Jeroen Roosen
        <i>16</i>&nbsp; */
        <b class="nc"><i>17</i>&nbsp;class BoardFactoryTest {</b>
        <i>18</i>&nbsp;
        <i>19</i>&nbsp; /**
        <i>20</i>&nbsp; * The factory under test.
        <i>21</i>&nbsp; */
        <i>22</i>&nbsp; private BoardFactory factory;
        <i>23</i>&nbsp;
        <i>24</i>&nbsp; /**
        <i>25</i>&nbsp; * Square on the board to test.
        <i>26</i>&nbsp; */
        <i>27</i>&nbsp; private Square s1;
        <i>28</i>&nbsp;
        <i>29</i>&nbsp; /**
        <i>30</i>&nbsp; * Square on the board to test.
        <i>31</i>&nbsp; */
        <i>32</i>&nbsp; private Square s2;
        <i>33</i>&nbsp;
        <i>34</i>&nbsp; /**
        <i>35</i>&nbsp; * Resets the factory under test.
        <i>36</i>&nbsp; */
        <i>37</i>&nbsp; @BeforeEach
        <i>38</i>&nbsp; void setUp() {
        <b class="nc"><i>39</i>&nbsp; PacManSprites sprites = mock(PacManSprites.class);</b>
        <b class="nc"><i>40</i>&nbsp; factory = new BoardFactory(sprites);</b>
        <i>41</i>&nbsp;
        <b class="nc"><i>42</i>&nbsp; s1 = new BasicSquare();</b>
        <b class="nc"><i>43</i>&nbsp; s2 = new BasicSquare();</b>
        <i>44</i>&nbsp; }
        <i>45</i>&nbsp;
        <i>46</i>&nbsp; /**
        <i>47</i>&nbsp; * Verifies that a single cell is connected to itself on all sides.
        <i>48</i>&nbsp; */
        <i>49</i>&nbsp; @Test
        <i>50</i>&nbsp; void worldIsRound() {
        <b class="nc"><i>51</i>&nbsp; factory.createBoard(new Square[][]{{s1}});</b>
        <b class="nc"><i>52</i>&nbsp;
            assertThat(Arrays.stream(Direction.values()).map(s1::getSquareAt)).containsOnly(s1);</b>
        <i>53</i>&nbsp; }
        <i>54</i>&nbsp;
        <i>55</i>&nbsp; /**
        <i>56</i>&nbsp; * Verifies a chain of cells is connected to the east.
        <i>57</i>&nbsp; */
        <i>58</i>&nbsp; @Test
        <i>59</i>&nbsp; void connectedEast() {
        <b class="nc"><i>60</i>&nbsp; factory.createBoard(new Square[][]{{s1}, {s2}});</b>
        <b class="nc"><i>61</i>&nbsp; assertThat(s1.getSquareAt(Direction.EAST)).isEqualTo(s2);</b>
        <b class="nc"><i>62</i>&nbsp; assertThat(s2.getSquareAt(Direction.EAST)).isEqualTo(s1);</b>
        <i>63</i>&nbsp; }
        <i>64</i>&nbsp;
        <i>65</i>&nbsp; /**
        <i>66</i>&nbsp; * Verifies a chain of cells is connected to the west.
        <i>67</i>&nbsp; */
        <i>68</i>&nbsp; @Test
        <i>69</i>&nbsp; void connectedWest() {
        <b class="nc"><i>70</i>&nbsp; factory.createBoard(new Square[][]{{s1}, {s2}});</b>
        <b class="nc"><i>71</i>&nbsp; assertThat(s1.getSquareAt(Direction.WEST)).isEqualTo(s2);</b>
        <b class="nc"><i>72</i>&nbsp; assertThat(s2.getSquareAt(Direction.WEST)).isEqualTo(s1);</b>
        <i>73</i>&nbsp; }
        <i>74</i>&nbsp;
        <i>75</i>&nbsp; /**
        <i>76</i>&nbsp; * Verifies a chain of cells is connected to the north.
        <i>77</i>&nbsp; */
        <i>78</i>&nbsp; @Test
        <i>79</i>&nbsp; void connectedNorth() {
        <b class="nc"><i>80</i>&nbsp; factory.createBoard(new Square[][]{{s1, s2}});</b>
        <b class="nc"><i>81</i>&nbsp; assertThat(s1.getSquareAt(Direction.NORTH)).isEqualTo(s2);</b>
        <b class="nc"><i>82</i>&nbsp; assertThat(s2.getSquareAt(Direction.NORTH)).isEqualTo(s1);</b>
        <i>83</i>&nbsp; }
        <i>84</i>&nbsp;
        <i>85</i>&nbsp; /**
        <i>86</i>&nbsp; * Verifies a chain of cells is connected to the south.
        <i>87</i>&nbsp; */
        <i>88</i>&nbsp; @Test
        <i>89</i>&nbsp; void connectedSouth() {
        <b class="nc"><i>90</i>&nbsp; factory.createBoard(new Square[][]{{s1, s2}});</b>
        <b class="nc"><i>91</i>&nbsp; assertThat(s1.getSquareAt(Direction.SOUTH)).isEqualTo(s2);</b>
        <b class="nc"><i>92</i>&nbsp; assertThat(s2.getSquareAt(Direction.SOUTH)).isEqualTo(s1);</b>
        <i>93</i>&nbsp; }
        <i>94</i>&nbsp;}
    </div>
</div>

<div class="footer">

    <div style="float:right;">generated on 2023-04-25 16:45</div>
</div>
</body>
</html>
